/****************************************************************
*****************************************************************/

*by Xiaodong Fan, fanxiaodong@gmail.com

#delimit ;

cap log close;
clear all;
drop _all;
set more 1;
pause on;

log using log_plot_data.log, replace;

global gpicsdir "pics_data";
global gdtadir ".";

do do_globals.do;

***********************************************;
**  Moments from the sipp data;
** outcome: dta_sipp_Moments.dta;
************************************************;
use ${gdtadir}/dta_sipp_Moments.dta, clear;

   local lvxlabel "xlabel(22 30(10)60 65,grid)";
   local lvcond "if t>=22 & t<=65";

   line lfpr_d t `lvcond', lpattern("l" "_") graphregion(color(white)) xtitle("Age") `lvxlabel'
        ytitle(${gytitle_lfpr}) yscale(range(${gyrange_lfpr})) ylabel(${gylabel_lfpr});
   graph export ${gpicsdir}/eps_data_lfpr.eps,replace;

   line lnw_d t `lvcond', lpattern("l" "_") graphregion(color(white)) xtitle("Age") `lvxlabel'
        ytitle(${gytitle_lnw}, axis(1)) ||
      line lfpr_d t `lvcond', lpattern("_") yaxis(2) ytitle(${gytitle_lfpr}, axis(2)) 
        legend(pos(6) ring(0) col(1) order(1 "Mean log measured wages" 2 "LFPR"));
   graph export ${gpicsdir}/eps_data_lnw_lfpr.eps,replace;

   line lnw_d lnw_fd_d t `lvcond', lpattern("l" "_") graphregion(color(white)) xtitle("Age") `lvxlabel'
        ytitle(${gytitle_lnw}) yscale(range(${gyrange_lnw_fe})) ylabel(${gylabel_lnw_fe})
        legend(pos(${gpos_lnw_fe}) ring(0) col(1) order(1 "Mean log measured wages" 2 "Mean log measured wages (FD)"));
   graph export ${gpicsdir}/eps_data_lnw_lnwfd.eps,replace;

   line sdlnw_d t `lvcond', lpattern("l" "_") graphregion(color(white))  xtitle("Age") `lvxlabel'
        ytitle(${gytitle_sdlnw}) yscale(range(${gyrange_sdlnw})) ylabel(${gylabel_sdlnw});
   graph export ${gpicsdir}/eps_data_sdlnw.eps,replace;

   line C_d t `lvcond', lpattern("l" "_") graphregion(color(white)) xtitle("Age") `lvxlabel'
        ytitle(${gytitle_C}) yscale(range(${gyrange_C})) ylabel(${gylabel_C});
   graph export ${gpicsdir}/eps_data_C.eps,replace;


   local lvxlabel_ssa "xlabel(60(1)70,grid)";
   local lvcond_ssa "if t>=60 & t<=70";


   line ssa_d t `lvcond_ssa', lpattern("l" "_") graphregion(color(white)) xtitle("Age") `lvxlabel_ssa'
        ytitle(${gytitle_ssa}) yscale(range(${gyrange_ssa})) ylabel(${gylabel_ssa});
   graph export ${gpicsdir}/eps_data_ssa.eps,replace;

cap log close;


